<template>
  <div>
    <el-table :data="signList" style="width: 100%">
      <el-table-column type="expand">
        <template slot-scope="props">
          <el-checkbox-group v-model="signsList" @change="changchecks">
            <el-checkbox v-for="(item, index) in props.row.dictionaries" :label="item.DID" :key="index">
              {{ item.name }}
            </el-checkbox>
          </el-checkbox-group>
        </template>
      </el-table-column>
      <el-table-column label="类型名称" prop="name"></el-table-column>
      <el-table-column label="描述" prop="describe"></el-table-column>
    </el-table>
    <div slot="footer" class="dialog-footer">
      <el-button @click="handleCancel">取 消</el-button>
      <el-button type="primary" @click="handleSign">确 定</el-button>
    </div>
  </div>
</template>

<script>
export default {
  props: {
    signList: {
      type: Array,
      default: () => {
        return [];
      }
    },
    persignlist: {
      type: Object,
      default: () => {
        return {};
      }
    }
  },
  data() {
    return {
      sign: [],
      signsList: this.persignlist.sign ? this.persignlist.sign : []
    };
  },
  //   },
  watch: {
    persignlist: {
      handler() {
        this.signsList = this.persignlist.sign;
      }
    },
    deep: true
  },
  mounted() {},
  methods: {
    // 选择
    changchecks(val) {},
    handleSign() {
      let params = {
        _id: this.persignlist._id,
        idCard: this.persignlist.idCard,
        sign: this.signsList
      };
      let paramJson = JSON.stringify(params);
      this.$api.personnel.signData(paramJson).then((res) => {
        if (res.code == 0) {
          this.$message.success("标记成功");
          this.$emit("handlebtn");
        }
      });
    },
    // 取消
    handleCancel() {
      this.$emit("closeDia");
    }
  }
};
</script>

<style  scoped>
</style>